package org.ws.edu.task1.ikhmyz;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;

public class GenerateEmails {

    public static void main(String[] args) {

        //******************CREATE FILE******************************

        PrintWriter newfile = null;
        try {
            newfile = new PrintWriter(new FileOutputStream("ContactsFile1.csv")); //Path and File Name
        } catch (FileNotFoundException e) {
            System.out.println("Error");
            System.exit(0);
        }
        //*****************FILE CREATED*****************************

        //*****************WRITE TO FILE****************************

        newfile.println("Salutation,First Name,Last Name,Company,Title,Mobile,Email or Fax");

        long phone = 2000000000l; //Initial Phone Number
        int first = 1; //Initial User Number
        int last = 10; //Last User Number
        int duplicateammount = 5; //Number Of Duplicated Users

        for (int i = first; i < last; i++) {
            newfile.println("Mr," + "Name" + i + "," + "Lastname" + i + "," + "Company" + i + "," + "QA" + i + "," + (phone + i) + ","
                    + "mw" + i + "@marketwire.com");
        }
        for (int c = 1; c <= duplicateammount; c++) {
            newfile.println("Mr," + "Name" + (last - 1) + "," + "Lastname" + (last - 1) + "," + "Company" + (last - 1) + "," + "QA"
                    + (last - 1) + "," + (phone + (last - 1)) + "," + "mw" + (last - 1) + "@marketwire.com");
        }
        newfile.close();
    }

}
